package com.yingsheng.bi.hks.basic;

import lombok.Getter;
import lombok.Setter;

@Getter
public class ReqContext {

    private static final ThreadLocal<ReqContext> contextTL = ThreadLocal.withInitial(ReqContext::new);

    @Setter
    private String identity;

    public static void create(String identity) {
        ReqContext reqContext = get();
        reqContext.setIdentity(identity);
    }

    public static ReqContext get() {
        return contextTL.get();
    }

    public static void reset() {
        contextTL.remove();
    }

}
